<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>

        (function () {
            let i = 10;
            console.log(i)
            let p1 = new Promise( (resolve, reject)=>{

                setTimeout(function () {
                    i++
                    resolve(i)
                },2000)

            })

            let p2 = new Promise( (resolve, reject)=>{

                setTimeout(function () {
                    i++
                    resolve(i)
                },3000)

            })

            let p3 = new Promise( (resolve, reject)=>{

                setTimeout(function () {
                    i++
                    resolve(i)
                },4000)

            })

            let Allp = Promise.all([p1,p2,p3])

            Allp.then( data=>{
                console.log(data)
            })

            console.log(i)
        })()

    </script>
</head>
<body>

</body>
</html>